import React, {Component} from "react";
import About from "./pages/About";
import Home from "./pages/Home";

import MyNavLink from "./components/MyNavLink";
import {Route, Switch} from "react-router-dom";


export default class App extends Component {

    render() {
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <div className="page-header"><h2>React Router Demo</h2></div>
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            <MyNavLink to="/about" className="list-group-item" children="About"></MyNavLink>
                            <MyNavLink to="/home/a/b" className="list-group-item" children="Home"></MyNavLink>
                        </div>
                    </div>
                    <Switch>
                        {/*
                        路由的严格匹配与模糊匹配
                           1.默认使用的是模糊匹配(简单记:【输入的路径】必须包含要【匹配的路径】，且顺序要一致)
                           2.开启严格匹配:<Route exact={true} path="/about" component={About}/>
                           3.严格匹配不要随便开启，需要再开，有些时候开启会导致无法继续匹配二级路由
                        */}

                        <Route path="/about" component={About}/>
                        <Route exact={true} path="/home" component={Home}/>
                    </Switch>
                </div>
            </div>


        )
    }
}